<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <style type="text/css">
        *{
            margin: 0px;
            padding: 0px;
        }
        #tou{
            position: absolute;
            width: 75px;
            height: 90px;
            left: 0px;
            top: 0px;
        }
    </style>
    <script type="text/javascript">
        window.onload = function(){
            var s = 0;
            var lef=0;
            var a = 0;
            var b = 0;
            var pid;
            var to = 0;
            var tou = document.getElementById('tou');
            var pp = document.getElementById('pp');
            function run(){
                if(tou.currentStyle){
                    lef = parseInt(tou.currentStyle["left"]);
                    to = parseInt(tou.currentStyle["top"]);
                }else{
                    lef = parseInt(getComputedStyle(tou,false)["left"]);
                    to = parseInt(getComputedStyle(tou,false)["top"]);
                }
                if(lef==document.documentElement.clientWidth-73){
                    a = 1;
                    pp.setAttribute('src','paopao2.gif');
                }else if(lef==0){
                    a = 0;
                    pp.setAttribute('src','paopao.gif');
                }
                if(to==document.documentElement.clientHeight-95){
                    b=1;
                }else if(to==0){
                    b=0;
                }
                if(a==0){
                    tou.style.left = (lef+1)+"px";
                }else if(a==1){
                    tou.style.left = (lef-1)+"px";
                }
                
                if(b == 0){
                   tou.style.top=(to+1)+"px"; 
                }else if(b == 1){
                    tou.style.top=(to-1)+"px";
                }
            }
            pp.onclick = function(){
                if(s == 0){
                    pid = window.setInterval(run,1);
                    s = 1;
                }else if(s == 1){
                    clearInterval(pid);
                    s = 0;
                }
            }
        }
    </script>
</head>
<body>
    <div id="tou">
        <img id="pp" src="./paopao.gif" alt="">
    </div>
</body>
</html>